package com.example.administrator.familfinalcialmanagement.greendao.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.example.administrator.familfinalcialmanagement.bean.ToastBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "TOAST_BEAN".
*/
public class ToastBeanDao extends AbstractDao<ToastBean, Long> {

    public static final String TABLENAME = "TOAST_BEAN";

    /**
     * Properties of entity ToastBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property Title = new Property(1, String.class, "title", false, "TITLE");
        public final static Property Info = new Property(2, String.class, "info", false, "INFO");
        public final static Property ToastStyle = new Property(3, String.class, "toastStyle", false, "TOAST_STYLE");
        public final static Property ToastTime = new Property(4, String.class, "toastTime", false, "TOAST_TIME");
        public final static Property ToastOne = new Property(5, String.class, "toastOne", false, "TOAST_ONE");
        public final static Property ToastTwo = new Property(6, String.class, "toastTwo", false, "TOAST_TWO");
        public final static Property ToastThree = new Property(7, String.class, "toastThree", false, "TOAST_THREE");
        public final static Property ToastFour = new Property(8, String.class, "toastFour", false, "TOAST_FOUR");
    }


    public ToastBeanDao(DaoConfig config) {
        super(config);
    }
    
    public ToastBeanDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"TOAST_BEAN\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
                "\"TITLE\" TEXT," + // 1: title
                "\"INFO\" TEXT," + // 2: info
                "\"TOAST_STYLE\" TEXT," + // 3: toastStyle
                "\"TOAST_TIME\" TEXT," + // 4: toastTime
                "\"TOAST_ONE\" TEXT," + // 5: toastOne
                "\"TOAST_TWO\" TEXT," + // 6: toastTwo
                "\"TOAST_THREE\" TEXT," + // 7: toastThree
                "\"TOAST_FOUR\" TEXT);"); // 8: toastFour
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TOAST_BEAN\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, ToastBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String title = entity.getTitle();
        if (title != null) {
            stmt.bindString(2, title);
        }
 
        String info = entity.getInfo();
        if (info != null) {
            stmt.bindString(3, info);
        }
 
        String toastStyle = entity.getToastStyle();
        if (toastStyle != null) {
            stmt.bindString(4, toastStyle);
        }
 
        String toastTime = entity.getToastTime();
        if (toastTime != null) {
            stmt.bindString(5, toastTime);
        }
 
        String toastOne = entity.getToastOne();
        if (toastOne != null) {
            stmt.bindString(6, toastOne);
        }
 
        String toastTwo = entity.getToastTwo();
        if (toastTwo != null) {
            stmt.bindString(7, toastTwo);
        }
 
        String toastThree = entity.getToastThree();
        if (toastThree != null) {
            stmt.bindString(8, toastThree);
        }
 
        String toastFour = entity.getToastFour();
        if (toastFour != null) {
            stmt.bindString(9, toastFour);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, ToastBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String title = entity.getTitle();
        if (title != null) {
            stmt.bindString(2, title);
        }
 
        String info = entity.getInfo();
        if (info != null) {
            stmt.bindString(3, info);
        }
 
        String toastStyle = entity.getToastStyle();
        if (toastStyle != null) {
            stmt.bindString(4, toastStyle);
        }
 
        String toastTime = entity.getToastTime();
        if (toastTime != null) {
            stmt.bindString(5, toastTime);
        }
 
        String toastOne = entity.getToastOne();
        if (toastOne != null) {
            stmt.bindString(6, toastOne);
        }
 
        String toastTwo = entity.getToastTwo();
        if (toastTwo != null) {
            stmt.bindString(7, toastTwo);
        }
 
        String toastThree = entity.getToastThree();
        if (toastThree != null) {
            stmt.bindString(8, toastThree);
        }
 
        String toastFour = entity.getToastFour();
        if (toastFour != null) {
            stmt.bindString(9, toastFour);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public ToastBean readEntity(Cursor cursor, int offset) {
        ToastBean entity = new ToastBean( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // title
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // info
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // toastStyle
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // toastTime
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // toastOne
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // toastTwo
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // toastThree
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // toastFour
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, ToastBean entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setTitle(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setInfo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setToastStyle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setToastTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setToastOne(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setToastTwo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setToastThree(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setToastFour(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(ToastBean entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(ToastBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(ToastBean entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
